package com.wwj.mapper;

import com.wwj.pojo.entity.Check;
import com.wwj.pojo.entity.SetmealCheck;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealCheckMapper {

    //根据SetmealId查询CheckIds

    List<Long> getCheckIdsBySetmealId(Long setmealId);

    //根据SetmealId查询Check
    List<Check> getCheckBySetmealId(Long setmealId);

    //根据SetmealId查询SetmealCheck表数据
    @Select(" select *  from setmeal_check where setmeal_id=#{setmealId}")
    List<SetmealCheck> getSetmealCheckBySetmealId(Long setmealId);

    //根据CheckIds查询SetmealCheck表数据

    List<SetmealCheck> getSetmealCheckByCheckIds(List<Long> checkIds);
    //插入关联表
    void insertSetmealCheckBatch(List<SetmealCheck> setmealChecks);

    //删除关联表数据
    void deleteBySetmealId(Long setmealId);


    //根据checkId查询关联数量
    @Select("select count(id) from setmeal_check where check_id = #{checkId}")
    Integer countByCheckId(Long checkId);
}
